/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.gemom;

import java.util.*;
/**
 *
 * @author Yair Diaz
 */
public class Bid {

    private int bidID;
    private int[] itemFlags;
    public Bid left=null;	
    public Bid right=null;
    private Vector<Item> items;
    public double price=0;//
    private int brokerIdflag=-88;// tells which broker submitted this bid
	
	//constructors
	public Bid(int bidID){
		this.bidID = bidID;
                this.items = new Vector<Item>();}
		
	public Bid(){}

        public void setItemflags(int fixedNumberitems, Vector<Item> fixedItemVector)
            {
                itemFlags = new int[fixedNumberitems];
		for(int i=0;i<itemFlags.length;i++)itemFlags[i]=0;
                for(int i=0;i<items.size();i++)
                    {  int a= fixedItemVector.indexOf(items.get(i));
                       itemFlags[a]=1 ;}
            }
         
        public void addItem(Item...items)
            {    for(int i=0;i<items.length;i++)
                    this.items.add(items[i]); }
        
	
	public int[] getItemflags(){return itemFlags;}
	public int getBidID(){return this.bidID;}
			
 
        public Vector<Item> getItemsVec(){return this.items;}
	
        public void setBrokerIdFlag(int brokerIdflag){this.brokerIdflag=brokerIdflag;}
        public int getBrokerIdFlag(){return this.brokerIdflag;}
        
        public String toString()
        {
            String ss="";
            for(int i=0;i<items.size();i++)
            {
             System.out.print(items.get(i)+ ", ");
             ss=ss+items.get(i)+ ", ";
            }
               
                return ss;
        }
	

}